package com.tamakloe.guestbook;

import java.util.Date;

public class PostGreetingForm extends AbstractGreetingForm {
    // Properties ---------------------------------------------------------------------------------

    private Greeting greeting = new Greeting();

    // Actions ------------------------------------------------------------------------------------

    /**
     * Post the message
     */
    public void postGreeting() {

        try {
            Date date = new Date();
            greeting.setDate(date);
        	greetingJdoDao.postGreeting(greeting);
            setSuccesMessage(getMessage(POSTED_MESSAGE_ID, ""));
        } catch (Exception e) {
        	setErrorMessage(getMessage(FAILED_MESSAGE_ID, e.getMessage()));
            e.printStackTrace();
        }        
    }

    // Getters ------------------------------------------------------------------------------------
    public Greeting getGreeting() {
        return greeting;
    }


}
